package com.ecoolex.ying.space.entity;

import com.ecoolex.framework.common.annotation.Description;
import java.util.ArrayList;
import java.util.Arrays;
import org.springframework.lang.NonNull;

/**
 *
 *   推送消息用户读取状态记录<br>
 *<br>
 * 数据表： push_message_read_state
 *
 */
@Description({"推送消息用户读取状态记录"})
public class PushMessageReadStateKey {
    /**
     *
     *   读取用户Id    <br>
     *<br>
     * 字段名： push_message_read_state.ReadUserId
     */
    @Description({"读取用户Id", "不能为空", "数据长度: 10"})
    @NonNull
    private Integer readUserId;

    /**
     *
     *   发布者用户Id    <br>
     *<br>
     * 字段名： push_message_read_state.ReleaseUserId
     */
    @Description({"发布者用户Id", "不能为空", "数据长度: 10"})
    @NonNull
    private Integer releaseUserId;

    /**
     * 获取参数<br><br>
     *
     *   读取用户Id    <br>
     *<br>
     * 字段名： push_message_read_state.ReadUserId
     */
    public Integer getReadUserId() {
        return readUserId;
    }

    /**
     * 设置参数<br><br>
     *
     *   读取用户Id<br>
     *<br>
     * 字段名： push_message_read_state.ReadUserId
     */
    public void setReadUserId(Integer readUserId) {
        this.readUserId = readUserId;
    }

    /**
     * 获取参数<br><br>
     *
     *   发布者用户Id    <br>
     *<br>
     * 字段名： push_message_read_state.ReleaseUserId
     */
    public Integer getReleaseUserId() {
        return releaseUserId;
    }

    /**
     * 设置参数<br><br>
     *
     *   发布者用户Id<br>
     *<br>
     * 字段名： push_message_read_state.ReleaseUserId
     */
    public void setReleaseUserId(Integer releaseUserId) {
        this.releaseUserId = releaseUserId;
    }

    public enum Column {
        readUserId("ReadUserId", "readUserId", "INTEGER", false),
        releaseUserId("ReleaseUserId", "releaseUserId", "INTEGER", false),
        newReadTime("NewReadTime", "newReadTime", "TIMESTAMP", false),
        deleted("Deleted", "deleted", "BIT", false),
        createUser("CreateUser", "createUser", "VARCHAR", true),
        createTime("CreateTime", "createTime", "TIMESTAMP", false),
        updateUser("UpdateUser", "updateUser", "VARCHAR", false),
        updateTime("UpdateTime", "updateTime", "TIMESTAMP", false);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }
    }
}